package com.jensen.jpa.web;
import com.jensen.jpa.domain.Customer;
import com.jensen.jpa.domain.CustomerRepository;
import com.jensen.jpa.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by Jensen on 2015/7/13.
 */
@RestController
public class CustomerController {

    @Autowired
    CustomerService customerService;

    @RequestMapping("/user/{name}")
    public List<Customer> getAllCustomer(@PathVariable String name){
        System.out.println("hahassssssssssssss====");
        List<Customer> list=this.customerService.findByFirstName(name);
        return list;
    }


    @RequestMapping("/users")
    public List<Customer> getAllCustomers(){
        System.out.println("hahassssssssssssss====");
        List<Customer> list=this.customerService.findAll();
        return list;
    }



}
